process.env['DEBUG'] = 'app';

var AV = require('leanengine');
var debug = require('debug')('app');

var APP_ID = process.env.LC_APP_ID || "Bv1JXOqnN1NQfns1BzPeF563-gzGzoHsz";
var APP_KEY = process.env.LC_APP_KEY || "gckHCAUV5ESaKethHblTfclR";
var MASTER_KEY = process.env.LC_APP_MASTER_KEY || "7nHPHTV4f1n3wqIqzUXRk2Wt";

AV.initialize(APP_ID, APP_KEY, MASTER_KEY);

var app = require('./server.js');



// 端口一定要从环境变量 `LC_APP_PORT` 中获取。
// LeanEngine 运行时会分配端口并赋值到该变量。
var PORT = parseInt(process.env.LC_APP_PORT || 3030);
var server = app.listen(PORT, function () {
  debug('Node app is running, port:', PORT);
});
